using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Pub_Module_MostProduct : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            BindData();

    }
    private void BindData()
    {
        string viewcount = System.Configuration.ConfigurationManager.AppSettings["MostPD"];

        clsWebShop cls = new clsWebShop();
        DataSet ds = null;
        ds = cls.Get_Most_ProductNoneProc(viewcount);
        dtlThumbnail.DataSource = ds;
        dtlThumbnail.DataBind();


    }

    protected void dtlThumbnail_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string imgUrl = DataBinder.Eval(e.Item.DataItem, "ImgUrl").ToString();
            Image imgNews = (Image)e.Item.FindControl("imgNews");
            if (imgUrl != "")
            {
                imgNews.ImageUrl = "~/" + imgUrl;
            }
            else
            {
                imgNews.ImageUrl = "~/Images/Body/Noimages.gif";
            }
        }
    }
}
